package com.aaa.exceptions;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author : luoBo
 */

public class CustomException extends RuntimeException{

    private int errorCode; // 自定义错误码
    private String errorMessage; // 自定义错误信息

    public CustomException(int errorCode, String errorMessage) {
        super(errorMessage); // 调用父类构造函数
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
    }
    public CustomException(String errorMessage) {
        this(500, errorMessage); // 默认错误码为 500
    }

    public int getErrorCode() {
        return errorCode;
    }

    public String getErrorMessage() {
        return errorMessage;
    }
}
